home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
L' Effet Pommier 3
/
L'Effet Pommier - Volume 03.iso
/
Programmation
/
Gooey1.3.1
/
C++ Templates
/
mmAlert.c
< prev
next >
Wrap
Text File
|
1994-04-17
|
10KB
|
314 lines
$$Loop Alerts
$$Message MM Alert, mm:mmA_$Worksheet.name$.cp
$$File mm:mmA_$Worksheet.name$.cp
/* mmA_$Worksheet.name$ Handle this alert */
/* $CopyRight$ */
/* File name: mmA_$Worksheet.name$
Function: Handle this alert.
$$if Alert.Stop
This is a STOP alert, it is used to inform the user that data is about to be lost.
It is also used for fatal type errors and tells the user about the error.
$$endif
$$if Alert.Note
This is a NOTE alert, it is used to inform the user of some general information.
This alert is not used if there is a possibility of losing any data.
$$endif
$$if Alert.Caution
This is a CAUTION alert, it is used to inform the user that if the current path
is taken then data may be lost. The user can change the present course and
save the data. This is the type of alert used to tell the user that he needs to
save the data before going on.
$$endif
This alert is called when:
The choices in this alert allow for:
History: $Date$ Original by $Author$
*/
#include "mmCommon$Prototype.name$.h" /* Common */
#include "Common$Prototype.name$.h" /* Common */
/* ======================================================= */
/* ======================================================= */
void CmmA$Worksheet.name$::Init() /* Initialize the alert variables */
{
$$Loop Control.type = Button
this->Enable_$Control.name$ = $Control.Active$;
$$EndLoop Control.type
$$Loop Control.type = Icon
this->Enable_$Control.name$ = $Control.Active$;
$$EndLoop
$$Loop Control.type = Picture
$$if Control.NonGraphic
this->Enable_$Control.name$ = $Control.Active$;
$$endif Control.NonGraphic
$$EndLoop
$$Loop Control.type = UButton
this->Enable_$Control.name$ = $Control.Active$;
$$EndLoop
$$Loop Control.type = HotRect
this->Enable_$Control.name$ = $Control.Active$;
$$EndLoop
$$Loop Control.type = Sicn
this->Enable_$Control.name$ = $Control.Active$;
$$EndLoop
}
/* ======================================================= */
void CmmA$Worksheet.name$::HandleFirstTime() /* Handle setup necessary for first time in */
{
DialogPtr theDialog;
Rect tempRect;
long LTemp;
theDialog = this->theWindow;
$$Loop Control.type = Button
SetupNormalControl(theDialog,ResA_$Control.name$,this->Enable_$Control.name$,0);
$$if Control.Default
/* This is the default selection, when RETURN is pressed. */
HiliteDefaultButton(theDialog,ResA_$Control.name$);
$$endif Control.Default
$$EndLoop Control.type
$$Loop Control.type = StaticText
$$if Control.SpecialText
/* Draw static text, $Control.FullName$ */
$$if Control.TextColor ! Black
if (Has.ColorQD) /* See if color QuickDraw is around */
{
DrawingColor.red = 0x$Control.RedTextColor$;
DrawingColor.green = 0x$Control.GreenTextColor$;
DrawingColor.blue = 0x$Control.BlueTextColor$;
RGBForeColor(&DrawingColor); /* Set the fore color */
RGBBackColor(&Saved_BackColor); /* Set the back color */
}
$$endif Control.TextColor
$$if Control.MultipleLine
SetRect(&tempRect,$Control.LeftPosition$,$Control.TopPosition$,$Control.RightPosition$,$Control.BottomPosition$);
DrawStaticTextBox(sResA_$Control.name$,&tempRect,$Control.TextAlignment$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$);
$$endif Control.MultipleLine
$$if Control.SingleLine
DrawStaticLine(sResA_$Control.name$,$Control.LeftPosition$,$Control.TopPosition$,$Control.TextSize$,$Control.TextFont$,$Control.TextStyle$);
$$endif Control.SingleLine
$$if Control.TextColor ! Black
if (Has.ColorQD) /* See if color QuickDraw is around */
{
RGBForeColor(&Black_ForeColor); /* Set the fore color */
RGBBackColor(&White_BackColor); /* Set the back color */
}
$$endif Control.TextColor
$$endif
$$EndLoop
$$Loop Control.type = Icon
$$if Control.NonGraphic
/* Draw an Icon button */
SetupIconSicn(theDialog,ResA_$Control.name$,this->Enable_$Control.name$,ResA_N_$Control.name$,ResA_H_$Control.name$);
$$endif Control.NonGraphic
$$EndLoop
$$Loop Control.type = Picture
$$if Control.NonGraphic
/* Draw a picture, $Control.FullName$ */
LTemp = ResA_N_$Control.name$; /* Picture ID and resize flag */
$$if Control.ClipPicture
LTemp = 0x00010000 | LTemp;
$$endif Control.ClipPicture
SetupTheItem(theDialog,ResA_$Control.name$,true,true,$Control.Active$,false,&tempRect,LTemp,0);/* Setup the Picture button */
$$endif Control.NonGraphic
$$EndLoop
$$Loop Control.type = UButton
SetupPlugin(theDialog,ResA_$Control.name$,Enable_$Control.name$,
ResA_N_$Control.name$,ResA_H_$Control.name$,sResA_$Control.name$);
$$EndLoop
$$Loop Control.type = Line
/* Draw a line, $Control.FullName$ */
$$if Control.GrayLine
PenPat(qd.gray); /* Set the gray pen pattern */
$$endif Control.GrayLine
$$if Control.LineWidth ! 1
PenSize($Control.LineWidth$,$Control.LineWidth$);
$$endif Control.LineWidth
MoveTo($Control.LeftPosition$,$Control.TopPosition$); /* Horz,vert, Move to starting position */
LineTo($Control.RightPosition$,$Control.BottomPosition$); /* Horz,vert, Draw to the ending position */
$$if Control.LineWidth ! 1
PenSize(1,1);
$$endif Control.LineWidth
$$if Control.GrayLine
PenPat(qd.black); /* Back to default pen pattern */
$$endif Control.GrayLine
$$EndLoop
$$Loop Control.type = HotRect
/* Draw a Hotspot or Rectangle, $Control.FullName$ */
SetupHotSpot(theDialog,ResA_$Control.name$,$Control.MakeHotSpot$,$Control.LineWidth$,
$Control.ShadowWidth$,sResA_$Control.name$,Enable_$Control.name$);
$$EndLoop
$$Loop Control.type = Sicn
/* Draw an Sicn */
$$if Control.Graphic
SetupIconSicn(theDialog,ResA_$Control.name$,Enable_$Control.name$,ResA_N_$Control.name$,ResA_N_$Control.name$);
$$endif Control.Graphic
$$if Control.NonGraphic
SetupIconSicn(theDialog,ResA_$Control.name$,Enable_$Control.name$,ResA_N_$Control.name$,ResA_H_$Control.name$);
$$endif Control.NonGraphic
$$EndLoop
this->DoFirstTime();
}
/* ======================================================= */
/* ======================================================= */
void CmmA$Worksheet.name$::BringUpAlert()
{
short itemHit; /* Get the selection ID in here */
AlertTHndl AlertResHandle; /* Resource handle for Alert */
Rect tempRect; /* Temp rect for moving the alert */
#if defined(powerc) || defined(__powerc)
ModalFilterUPP theFilter;
#endif
gCurrentAlert = g$Worksheet.name$;
AlertResHandle = (AlertTHndl)GetResource('ALRT',ResA_$Worksheet.name$);/* Get the Alerts resource template handle */
HLock((Handle)AlertResHandle); /* Lock the resource down while we use it */
$$if Worksheet.Center
tempRect = (*AlertResHandle)->boundsRect; /* Get the alerts position and size */
$$if Worksheet.CenterHorz
tempRect.left = ((screenRect.bounds.right - screenRect.bounds.left) - (tempRect.right - tempRect.left)) / 2; /* Center Horz */
$$endif Worksheet.CenterHorz
$$if Worksheet.CenterVert
tempRect.top = ((screenRect.bounds.bottom - screenRect.bounds.top) - (tempRect.bottom - tempRect.top)) / 3; /* 1/3 vert */
$$endif Worksheet.CenterVert
tempRect.bottom = tempRect.top + ((*AlertResHandle)->boundsRect.bottom - (*AlertResHandle)->boundsRect.top);
tempRect.right = tempRect.left + ((*AlertResHandle)->boundsRect.right - (*AlertResHandle)->boundsRect.left);
(*AlertResHandle)->boundsRect = tempRect; /* Place the centered position back in the template */
$$endif
gCurrentAlert->DidFirstTime = FALSE; /* Set the flag for the filter proc */
$$Link Worksheet.Open
/* Let the OS handle the Alert and wait for a result to be returned */
#if defined(powerc) || defined(__powerc)
theFilter = NewModalFilterProc(theAlertFilter);
#endif
$$if Alert.Stop
#if defined(powerc) || defined(__powerc)
itemHit = StopAlert(ResA_$Worksheet.name$,theFilter); /* Bring in the alert resource */
#else
itemHit = StopAlert(ResA_$Worksheet.name$,(ModalFilterProcPtr)&theAlertFilter);/* Bring in the alert resource */
#endif
$$endif
$$if Alert.Note
#if defined(powerc) || defined(__powerc)
itemHit = NoteAlert(ResA_$Worksheet.name$,theFilter); /* Bring in the alert resource */
#else
itemHit = NoteAlert(ResA_$Worksheet.name$,(ModalFilterProcPtr)&theAlertFilter);/* Bring in the alert resource */
#endif
$$endif
$$if Alert.Caution
#if defined(powerc) || defined(__powerc)
itemHit = CautionAlert(ResA_$Worksheet.name$,theFilter); /* Bring in the alert resource */
#else
itemHit = CautionAlert(ResA_$Worksheet.name$,(ModalFilterProcPtr)&theAlertFilter);/* Bring in the alert resource */
#endif
$$endif
HUnlock((Handle)AlertResHandle); /* Release the alert handle to float */
$$Loop Control.type = Button
$$if Control.HasLinks
$$if Control.Default
/* This is the default selection, when RETURN is pressed. */
$$endif
if (ResA_$Control.name$ == itemHit) /* $Control.FullName$,See if this control was selected */
{
$$Link Control.Select
}
$$endif
$$EndLoop Control.type
$$Loop Control.type = Icon
$$if Control.HasLinks
$$if Control.NonGraphic
if (ResA_$Control.name$ == itemHit) /* $Control.FullName$,See if this control was selected */
{
$$Link Control.Select
}
$$endif Control.NonGraphic
$$endif
$$EndLoop
$$Loop Control.type = Picture
$$if Control.HasLinks
$$if Control.NonGraphic
if (ResA_$Control.name$ == itemHit) /* $Control.FullName$,See if this control was selected */
{
$$Link Control.Select
}
$$endif Control.NonGraphic
$$endif
$$EndLoop
$$Loop Control.type = UButton
$$if Control.HasLinks
if (ResA_$Control.name$ == itemHit) /* $Control.FullName$,See if this control was selected */
{
$$Link Control.Select
}
$$endif
$$EndLoop
$$Loop Control.type = HotRect
$$if Control.HasLinks
$$if Control.HotSpot
if (ResA_$Control.name$ == itemHit) /* $Control.FullName$,See if this control was selected */
{
$$Link Control.Select
}
$$endif Control.HotSpot
$$endif
$$EndLoop
$$Loop Control.type = Sicn
$$if Control.HasLinks
$$if Control.NonGraphic
if (ResA_$Control.name$ == itemHit) /* $Control.FullName$,See if this control was selected */
{
$$Link Control.Select
}
$$endif Control.NonGraphic
$$endif
$$EndLoop
gCurrentAlert->DoItemHit(itemHit); /* Tell the user routine which item was selected */
$$Link Worksheet.Close
gCurrentAlert = nil;
}
/* ======================================================= */
/* ======================================================= */
$$CloseFile
$$EndLoop